package com.sys.midware.memcached.exceptions;


/**
 * mongo操作处理异常
 * <b>ClassName：</b> MongoHandlerException <br/>
 * <b>Description：</b> TODO <br/>
 * <b>@author：</b> mobing <br/>
 * <b>@date：</b> 2015年10月21日 下午12:48:26 <br/>
 * <b>@version: </b>  <br/>
 */
public class BMemcachedException extends Exception {

    private static final long serialVersionUID = 1L;

    public final static int GENERAL_ERROR = 0;
    public final static int DATABASE_ERROR = 1;
    public final static int INTERRUPTED = 2;
    public final static int SETUP_ERROR = 3;
    public final static int DATABASE_CONNECTION_ERROR = 4;
    public final static int REPOSITORY_CONNECTION_ERROR = 5;
    public final static int DATABASE_TRANSACTION_ABORT = 6;
    public final static int FILE_DIR_CREATE_FAILED = 7;
    public final static int DB_RECORD_NOT_EXIST = 8;
    public final static int CRAWLER_NODE_NOT_AVAILABLE = 8;
    // MHL

    protected int errcode;

    public BMemcachedException(String errString) {
        super(errString);
        this.errcode = GENERAL_ERROR;
    }

    public BMemcachedException(String errString, int errcode) {
        super(errString);
        this.errcode = errcode;
    }

    public BMemcachedException(String errString, Throwable cause, int errcode) {
        super(errString, cause);
        this.errcode = errcode;
    }

    public BMemcachedException(String errString, Throwable cause) {
        super(errString, cause);
        this.errcode = GENERAL_ERROR;
    }

    public BMemcachedException(Throwable cause, int errcode) {
        super(cause);
        this.errcode = errcode;
    }

    public BMemcachedException(Throwable cause) {
        super(cause);
        this.errcode = GENERAL_ERROR;
    }

    public int getErrorCode() {
        return errcode;
    }

}
